package cn.iocoder.yudao.module.famous.doctor.controller.app.video;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.video.vo.*;
import cn.iocoder.yudao.module.famous.doctor.convert.video.FamVideoConvert;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.video.FamVideoDO;
import cn.iocoder.yudao.module.famous.doctor.service.video.FamVideoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 视频管理")
@RestController
@RequestMapping("/famous.doctor/fam-video/app")
@Validated
public class AppFamVideoController {

    @Resource
    private FamVideoService famVideoService;



    @GetMapping("/get")
    @Operation(summary = "获得视频管理")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    public CommonResult<FamVideoRespVO> getFamVideo(@RequestParam("id") Long id) {
        FamVideoDO famVideo = famVideoService.getFamVideo(id);
        return success(FamVideoConvert.INSTANCE.convert(famVideo));
    }

    @GetMapping("/page")
    @Operation(summary = "获得视频管理分页")
    public CommonResult<PageResult<FamVideoRespVO>> getFamVideoPage(@Valid FamVideoPageReqVO pageVO) {
        PageResult<FamVideoDO> pageResult = famVideoService.getFamVideoPage(pageVO);
        return success(FamVideoConvert.INSTANCE.convertPage(pageResult));
    }

}
